/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package svp;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author kandamaran
 */
@Entity
@Table(name = "invoice_tbl", catalog = "svpdatabase", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "InvoiceTbl.findAll", query = "SELECT i FROM InvoiceTbl i"),
    @NamedQuery(name = "InvoiceTbl.invoiceNo", query = "SELECT i.invoiceNo FROM InvoiceTbl i"),
    @NamedQuery(name = "InvoiceTbl.findByInvoiceNo", query = "SELECT i FROM InvoiceTbl i WHERE i.invoiceNo = :invoiceNo"),
    @NamedQuery(name = "InvoiceTbl.findByInvoiceType", query = "SELECT i FROM InvoiceTbl i WHERE i.invoiceType = :invoiceType"),
    @NamedQuery(name = "InvoiceTbl.findByInvoicepayType", query = "SELECT i FROM InvoiceTbl i WHERE i.invoicepayType = :invoicepayType"),
    @NamedQuery(name = "InvoiceTbl.findByInvoicecustomerName", query = "SELECT i FROM InvoiceTbl i WHERE i.invoicecustomerName = :invoicecustomerName"),
    @NamedQuery(name = "InvoiceTbl.findByInvoicecustomerPhNo", query = "SELECT i FROM InvoiceTbl i WHERE i.invoicecustomerPhNo = :invoicecustomerPhNo"),
    @NamedQuery(name = "InvoiceTbl.findByInvoiceDate", query = "SELECT i FROM InvoiceTbl i WHERE i.invoiceDate = :invoiceDate"),
    @NamedQuery(name = "InvoiceTbl.findByInvoiceAmount", query = "SELECT i FROM InvoiceTbl i WHERE i.invoiceAmount = :invoiceAmount"),
    @NamedQuery(name = "InvoiceTbl.findByInvoiceTotal", query = "SELECT i FROM InvoiceTbl i WHERE i.invoiceTotal = :invoiceTotal"),
    @NamedQuery(name = "InvoiceTbl.findByInvoiceTotaltax", query = "SELECT i FROM InvoiceTbl i WHERE i.invoiceTotaltax = :invoiceTotaltax"),
    @NamedQuery(name = "InvoiceTbl.findByInvoiceBalance", query = "SELECT i FROM InvoiceTbl i WHERE i.invoiceBalance = :invoiceBalance"),
    @NamedQuery(name = "InvoiceTbl.findByInvoiceoverallTotal", query = "SELECT i FROM InvoiceTbl i WHERE i.invoiceoverallTotal = :invoiceoverallTotal")})
public class InvoiceTbl implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "invoice_no")
    private String invoiceNo;
    @Column(name = "invoice_type")
    private String invoiceType;
    @Column(name = "invoice_payType")
    private String invoicepayType;
    @Column(name = "invoice_customerName")
    private String invoicecustomerName;
    @Column(name = "invoice_customerPhNo")
    private String invoicecustomerPhNo;
    @Column(name = "invoice_date")
    @Temporal(TemporalType.DATE)
    private Date invoiceDate;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "invoice_amount")
    private Float invoiceAmount;
    @Column(name = "invoice_total")
    private Float invoiceTotal;
    @Column(name = "invoice_totaltax")
    private Float invoiceTotaltax;
    @Column(name = "invoice_balance")
    private Float invoiceBalance;
    @Column(name = "invoice_overallTotal")
    private Float invoiceoverallTotal;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "invoiceTbl")
    private InvoiceProductsTbl invoiceProductsTbl;

    public InvoiceTbl() {
    }

    public InvoiceTbl(String invoiceNo) {
        this.invoiceNo = invoiceNo;
    }

    public String getInvoiceNo() {
        return invoiceNo;
    }

    public void setInvoiceNo(String invoiceNo) {
        String oldInvoiceNo = this.invoiceNo;
        this.invoiceNo = invoiceNo;
        changeSupport.firePropertyChange("invoiceNo", oldInvoiceNo, invoiceNo);
    }

    public String getInvoiceType() {
        return invoiceType;
    }

    public void setInvoiceType(String invoiceType) {
        String oldInvoiceType = this.invoiceType;
        this.invoiceType = invoiceType;
        changeSupport.firePropertyChange("invoiceType", oldInvoiceType, invoiceType);
    }

    public String getInvoicepayType() {
        return invoicepayType;
    }

    public void setInvoicepayType(String invoicepayType) {
        String oldInvoicepayType = this.invoicepayType;
        this.invoicepayType = invoicepayType;
        changeSupport.firePropertyChange("invoicepayType", oldInvoicepayType, invoicepayType);
    }

    public String getInvoicecustomerName() {
        return invoicecustomerName;
    }

    public void setInvoicecustomerName(String invoicecustomerName) {
        String oldInvoicecustomerName = this.invoicecustomerName;
        this.invoicecustomerName = invoicecustomerName;
        changeSupport.firePropertyChange("invoicecustomerName", oldInvoicecustomerName, invoicecustomerName);
    }

    public String getInvoicecustomerPhNo() {
        return invoicecustomerPhNo;
    }

    public void setInvoicecustomerPhNo(String invoicecustomerPhNo) {
        String oldInvoicecustomerPhNo = this.invoicecustomerPhNo;
        this.invoicecustomerPhNo = invoicecustomerPhNo;
        changeSupport.firePropertyChange("invoicecustomerPhNo", oldInvoicecustomerPhNo, invoicecustomerPhNo);
    }

    public Date getInvoiceDate() {
        return invoiceDate;
    }

    public void setInvoiceDate(Date invoiceDate) {
        Date oldInvoiceDate = this.invoiceDate;
        this.invoiceDate = invoiceDate;
        changeSupport.firePropertyChange("invoiceDate", oldInvoiceDate, invoiceDate);
    }

    public Float getInvoiceAmount() {
        return invoiceAmount;
    }

    public void setInvoiceAmount(Float invoiceAmount) {
        Float oldInvoiceAmount = this.invoiceAmount;
        this.invoiceAmount = invoiceAmount;
        changeSupport.firePropertyChange("invoiceAmount", oldInvoiceAmount, invoiceAmount);
    }

    public Float getInvoiceTotal() {
        return invoiceTotal;
    }

    public void setInvoiceTotal(Float invoiceTotal) {
        Float oldInvoiceTotal = this.invoiceTotal;
        this.invoiceTotal = invoiceTotal;
        changeSupport.firePropertyChange("invoiceTotal", oldInvoiceTotal, invoiceTotal);
    }

    public Float getInvoiceTotaltax() {
        return invoiceTotaltax;
    }

    public void setInvoiceTotaltax(Float invoiceTotaltax) {
        Float oldInvoiceTotaltax = this.invoiceTotaltax;
        this.invoiceTotaltax = invoiceTotaltax;
        changeSupport.firePropertyChange("invoiceTotaltax", oldInvoiceTotaltax, invoiceTotaltax);
    }

    public Float getInvoiceBalance() {
        return invoiceBalance;
    }

    public void setInvoiceBalance(Float invoiceBalance) {
        Float oldInvoiceBalance = this.invoiceBalance;
        this.invoiceBalance = invoiceBalance;
        changeSupport.firePropertyChange("invoiceBalance", oldInvoiceBalance, invoiceBalance);
    }

    public Float getInvoiceoverallTotal() {
        return invoiceoverallTotal;
    }

    public void setInvoiceoverallTotal(Float invoiceoverallTotal) {
        Float oldInvoiceoverallTotal = this.invoiceoverallTotal;
        this.invoiceoverallTotal = invoiceoverallTotal;
        changeSupport.firePropertyChange("invoiceoverallTotal", oldInvoiceoverallTotal, invoiceoverallTotal);
    }

    public InvoiceProductsTbl getInvoiceProductsTbl() {
        return invoiceProductsTbl;
    }

    public void setInvoiceProductsTbl(InvoiceProductsTbl invoiceProductsTbl) {
        this.invoiceProductsTbl = invoiceProductsTbl;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (invoiceNo != null ? invoiceNo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof InvoiceTbl)) {
            return false;
        }
        InvoiceTbl other = (InvoiceTbl) object;
        if ((this.invoiceNo == null && other.invoiceNo != null) || (this.invoiceNo != null && !this.invoiceNo.equals(other.invoiceNo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "svp.InvoiceTbl[ invoiceNo=" + invoiceNo + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
